.class public Lcom/zuiapps/library/db/UpgradeSharePrefHelper;
.super Ljava/lang/Object;
.source "UpgradeSharePrefHelper.java"


# static fields
.field public static final LAST_VERSION:Ljava/lang/String; = "last_version"

.field public static final UPDATE_DESC:Ljava/lang/String; = "update_desc"

.field public static final UPDATE_URL:Ljava/lang/String; = "update_url"

.field private static sharePrefHelper:Lcom/zuiapps/library/db/UpgradeSharePrefHelper;


# instance fields
.field private final PREFS_FILE:Ljava/lang/String;

.field private prefs:Landroid/content/SharedPreferences;


# direct methods
.method static constructor <clinit>()V
    .registers 1

    .prologue
    .line 17
    const/4 v0, 0x0

    sput-object v0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->sharePrefHelper:Lcom/zuiapps/library/db/UpgradeSharePrefHelper;

    return-void
.end method

.method protected constructor <init>(Landroid/content/Context;)V
    .registers 6
    .param p1, "cxt"    # Landroid/content/Context;

    .prologue
    .line 25
    invoke-direct {p0}, Ljava/lang/Object;-><init>()V

    .line 16
    const/4 v2, 0x0

    iput-object v2, p0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->prefs:Landroid/content/SharedPreferences;

    .line 18
    const-string v2, "zuiapps_upgrade.prefs"

    iput-object v2, p0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->PREFS_FILE:Ljava/lang/String;

    .line 28
    :try_start_a
    invoke-virtual {p1}, Landroid/content/Context;->getPackageName()Ljava/lang/String;

    move-result-object v2

    const/4 v3, 0x2

    invoke-virtual {p1, v2, v3}, Landroid/content/Context;->createPackageContext(Ljava/lang/String;I)Landroid/content/Context;

    move-result-object v0

    .line 29
    .local v0, "context":Landroid/content/Context;
    const-string v2, "zuiapps_upgrade.prefs"

    const/4 v3, 0x7

    invoke-virtual {v0, v2, v3}, Landroid/content/Context;->getSharedPreferences(Ljava/lang/String;I)Landroid/content/SharedPreferences;

    move-result-object v2

    iput-object v2, p0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->prefs:Landroid/content/SharedPreferences;
    :try_end_1c
    .catch Landroid/content/pm/PackageManager$NameNotFoundException; {:try_start_a .. :try_end_1c} :catch_1d

    .line 34
    .end local v0    # "context":Landroid/content/Context;
    :goto_1c
    return-void

    .line 30
    :catch_1d
    move-exception v1

    .line 31
    .local v1, "e":Landroid/content/pm/PackageManager$NameNotFoundException;
    invoke-virtual {v1}, Landroid/content/pm/PackageManager$NameNotFoundException;->printStackTrace()V

    goto :goto_1c
.end method

.method public static getInstance(Landroid/content/Context;)Lcom/zuiapps/library/db/UpgradeSharePrefHelper;
    .registers 2
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 37
    sget-object v0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->sharePrefHelper:Lcom/zuiapps/library/db/UpgradeSharePrefHelper;

    if-nez v0, :cond_b

    .line 38
    new-instance v0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;

    invoke-direct {v0, p0}, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;-><init>(Landroid/content/Context;)V

    sput-object v0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->sharePrefHelper:Lcom/zuiapps/library/db/UpgradeSharePrefHelper;

    .line 40
    :cond_b
    sget-object v0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->sharePrefHelper:Lcom/zuiapps/library/db/UpgradeSharePrefHelper;

    return-object v0
.end method

.method public static newInstance(Landroid/content/Context;)Lcom/zuiapps/library/db/UpgradeSharePrefHelper;
    .registers 2
    .param p0, "context"    # Landroid/content/Context;

    .prologue
    .line 44
    new-instance v0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;

    invoke-direct {v0, p0}, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;-><init>(Landroid/content/Context;)V

    sput-object v0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->sharePrefHelper:Lcom/zuiapps/library/db/UpgradeSharePrefHelper;

    .line 45
    sget-object v0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->sharePrefHelper:Lcom/zuiapps/library/db/UpgradeSharePrefHelper;

    return-object v0
.end method


# virtual methods
.method public getPref(Ljava/lang/String;F)F
    .registers 4
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "defaultValue"    # F

    .prologue
    .line 95
    iget-object v0, p0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->prefs:Landroid/content/SharedPreferences;

    invoke-interface {v0, p1, p2}, Landroid/content/SharedPreferences;->getFloat(Ljava/lang/String;F)F

    move-result v0

    return v0
.end method

.method public getPref(Ljava/lang/String;I)I
    .registers 4
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "defaultValue"    # I

    .prologue
    .line 87
    iget-object v0, p0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->prefs:Landroid/content/SharedPreferences;

    invoke-interface {v0, p1, p2}, Landroid/content/SharedPreferences;->getInt(Ljava/lang/String;I)I

    move-result v0

    return v0
.end method

.method public getPref(Ljava/lang/String;J)J
    .registers 6
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "defaultValue"    # J

    .prologue
    .line 91
    iget-object v0, p0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->prefs:Landroid/content/SharedPreferences;

    invoke-interface {v0, p1, p2, p3}, Landroid/content/SharedPreferences;->getLong(Ljava/lang/String;J)J

    move-result-wide v0

    return-wide v0
.end method

.method public getPref(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
    .registers 4
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "defaultValue"    # Ljava/lang/String;

    .prologue
    .line 83
    iget-object v0, p0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->prefs:Landroid/content/SharedPreferences;

    invoke-interface {v0, p1, p2}, Landroid/content/SharedPreferences;->getString(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v0

    return-object v0
.end method

.method public getPref(Ljava/lang/String;Ljava/lang/Boolean;)Z
    .registers 5
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "defaultValue"    # Ljava/lang/Boolean;

    .prologue
    .line 79
    iget-object v0, p0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->prefs:Landroid/content/SharedPreferences;

    invoke-virtual {p2}, Ljava/lang/Boolean;->booleanValue()Z

    move-result v1

    invoke-interface {v0, p1, v1}, Landroid/content/SharedPreferences;->getBoolean(Ljava/lang/String;Z)Z

    move-result v0

    return v0
.end method

.method public removePref(Ljava/lang/String;)Z
    .registers 4
    .param p1, "key"    # Ljava/lang/String;

    .prologue
    .line 99
    iget-object v1, p0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->prefs:Landroid/content/SharedPreferences;

    invoke-interface {v1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    .line 100
    .local v0, "editor":Landroid/content/SharedPreferences$Editor;
    invoke-interface {v0, p1}, Landroid/content/SharedPreferences$Editor;->remove(Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    .line 101
    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z

    move-result v1

    return v1
.end method

.method public setPref(Ljava/lang/String;F)V
    .registers 5
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "value"    # F

    .prologue
    .line 61
    iget-object v1, p0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->prefs:Landroid/content/SharedPreferences;

    invoke-interface {v1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    .line 62
    .local v0, "editor":Landroid/content/SharedPreferences$Editor;
    invoke-interface {v0, p1, p2}, Landroid/content/SharedPreferences$Editor;->putFloat(Ljava/lang/String;F)Landroid/content/SharedPreferences$Editor;

    .line 63
    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 64
    return-void
.end method

.method public setPref(Ljava/lang/String;I)V
    .registers 5
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "value"    # I

    .prologue
    .line 67
    iget-object v1, p0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->prefs:Landroid/content/SharedPreferences;

    invoke-interface {v1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    .line 68
    .local v0, "editor":Landroid/content/SharedPreferences$Editor;
    invoke-interface {v0, p1, p2}, Landroid/content/SharedPreferences$Editor;->putInt(Ljava/lang/String;I)Landroid/content/SharedPreferences$Editor;

    .line 69
    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 70
    return-void
.end method

.method public setPref(Ljava/lang/String;J)V
    .registers 6
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "value"    # J

    .prologue
    .line 73
    iget-object v1, p0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->prefs:Landroid/content/SharedPreferences;

    invoke-interface {v1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    .line 74
    .local v0, "editor":Landroid/content/SharedPreferences$Editor;
    invoke-interface {v0, p1, p2, p3}, Landroid/content/SharedPreferences$Editor;->putLong(Ljava/lang/String;J)Landroid/content/SharedPreferences$Editor;

    .line 75
    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 76
    return-void
.end method

.method public setPref(Ljava/lang/String;Ljava/lang/String;)V
    .registers 5
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "value"    # Ljava/lang/String;

    .prologue
    .line 55
    iget-object v1, p0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->prefs:Landroid/content/SharedPreferences;

    invoke-interface {v1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    .line 56
    .local v0, "editor":Landroid/content/SharedPreferences$Editor;
    invoke-interface {v0, p1, p2}, Landroid/content/SharedPreferences$Editor;->putString(Ljava/lang/String;Ljava/lang/String;)Landroid/content/SharedPreferences$Editor;

    .line 57
    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 58
    return-void
.end method

.method public setPref(Ljava/lang/String;Z)V
    .registers 5
    .param p1, "key"    # Ljava/lang/String;
    .param p2, "value"    # Z

    .prologue
    .line 49
    iget-object v1, p0, Lcom/zuiapps/library/db/UpgradeSharePrefHelper;->prefs:Landroid/content/SharedPreferences;

    invoke-interface {v1}, Landroid/content/SharedPreferences;->edit()Landroid/content/SharedPreferences$Editor;

    move-result-object v0

    .line 50
    .local v0, "editor":Landroid/content/SharedPreferences$Editor;
    invoke-interface {v0, p1, p2}, Landroid/content/SharedPreferences$Editor;->putBoolean(Ljava/lang/String;Z)Landroid/content/SharedPreferences$Editor;

    .line 51
    invoke-interface {v0}, Landroid/content/SharedPreferences$Editor;->commit()Z

    .line 52
    return-void
.end method
